<?php
if(!empty($news[0])){
?>
<article class="latest-news">
	<header>
		<span class="date">
			<?php echo date('M d, Y', strtotime($news[0]['create_date']));?>
		</span>
		<h1 class="title">
		<?php echo $news[0]['title'];?>
		</h1>
	</header>
	<figure>
		<img src="<?php echo config_item('asset');?>img/product/<?php echo str_replace('.', '_thumb.', $news[0]['pic1']);?>" width="300" height="239">
	</figure>
	<a class="readmore" href="<?php echo site_url('news/'.$news[0]['id'].'/'.$news[0]['slug']);?>">Read more</a>
</article>
<?php
}

$cnt = count($news);
if($cnt > 1){
?>
<h1 class="product-title">More News</h1>
<div class="box-space"></div>
<div class="news">
	<ul>
		<?php 
		for ($i=1; $i < $cnt; $i++) { 
			$news_detail = site_url('news/'.$news[$i]['id'].'/'.$news[$i]['slug']);
			$title = htmlentities($news[$i]['title']);
		?>
		<li>
			<div class="thumb">
				<a href="<?php echo $news_detail;?>" title="<?php echo $title;?>">
					<img alt="<?php echo $title;?>" src="<?php echo config_item('asset');?>img/product/<?php echo str_replace('.', '_thumb.', $news[0]['pic1']);?>" width="220" height="115">
				</a>
			</div>
			<a class="title" href="<?php echo $news_detail;?>" title="<?php echo $title;?>">
				<?php echo $news[$i]['title'];?>
			</a>
			<a class="readmore" href="<?php echo $news_detail;?>" title="<?php echo $title;?>">
				Read more
			</a>
		</li>
		<?php } ?>
	</ul>
</div>
<?php
}
?>